/**
 * 
 */
package com.gopay.common.cps.manager.bt.impl;

import java.io.Serializable;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.gopay.common.cps.dao.bt.CpsBtContractInfoQueryDAO;
import com.gopay.common.cps.dao.bt.CpsBtContractLogQueryDAO;
import com.gopay.common.cps.manager.bt.FullCpsBtContractQueryManager;
import com.gopay.common.domain.cps.CpsBtContractInfo;
import com.gopay.common.domain.cps.CpsBtContractLog;
import com.gopay.common.domain.cps.vo.CpsBtContractVo;


/**
 * @FullCpsBtContractQueryManagerImpl.java
 * @author xiefei
 * @2013-1-22 下午1:49:37  www.gopay.com.cn Inc.All rights reserved.
 */
@Service("fullCpsBtContractQueryManager")
public class FullCpsBtContractQueryManagerImpl implements FullCpsBtContractQueryManager {

    @Resource(name = "cpsBtContractInfoQueryDAO")
    private CpsBtContractInfoQueryDAO cpsBtContractInfoQueryDAO;
        
    @Resource(name = "cpsBtContractLogQueryDAO")
    private CpsBtContractLogQueryDAO cpsBtContractLogQueryDAO;
           
    @Override
    public CpsBtContractVo get(Serializable id) {
        // TODO Auto-generated method stub
        CpsBtContractLog contractLog = cpsBtContractLogQueryDAO.find(CpsBtContractLog.class, id);
        if( null != contractLog){
            CpsBtContractInfo contractInfo = cpsBtContractInfoQueryDAO.getByContractNo(contractLog.getContractId());
            if( null != contractInfo){
                return new CpsBtContractVo(contractLog,contractInfo);
            }
        }
        return null;
    }

    
    @Override
    public List<CpsBtContractVo> get(Map<Object, Object> paraMap) {
        // TODO Auto-generated method stub
        return null;
    }

    
    @Override
    public List<CpsBtContractVo> getAll() {
        // TODO Auto-generated method stub
        return null;
    }
    
    /**
     * 根据协议号获取合约信息
     * 
     * @param contractNo
     * @return
     */
    @Override
    public CpsBtContractInfo getByContractNo(String contractNo){
        return cpsBtContractInfoQueryDAO.getByContractNo(contractNo);
    }
    
    /**
     * 获取合约日志
     * 
     * @param contractId
     * @param inTxnCD
     * @return
     */
    @Override
    public CpsBtContractLog getContractLog(String contractId, String inTxnCD){
        return cpsBtContractLogQueryDAO.getContractLog(contractId, inTxnCD);
    }

}
